package StudyCode.summary.mycollection;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class ConvertAStringToACharArray {
	public static void main(String[] argv) {
		String str = "www.tah1986.com";
		System.out.println(java.util.Arrays.toString(strToChars(str)));
	}

	private static final char[] EMPTY_CHAR_ARRAY = new char[0];

	public static char[] strToChars(String str) {
		int len;
		char[] ret;

		if (str == null)
			return EMPTY_CHAR_ARRAY;
		len = str.length();
		ret = new char[len];
		str.getChars(0, len, ret, 0);
		return ret;
	}
}
